package com.sise.wangzhan.controller;

import com.sise.wangzhan.client.PersonService;
import com.sise.wangzhan.entity.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Classname PersonInvokerController
 * @Description TODO
 * @Date 2020/5/14 11:39
 * @Created by wangzhan
 */
@RestController
public class PersonInvokerController {
    @Autowired
    PersonService personService;

    @RequestMapping(value = "/person-invoker/{personId}", method = RequestMethod.GET)
    public String bookInvoker(@PathVariable Integer personId){
        // 调用book服务查找
        Person person = personService.getPerson(personId);
        // 控制台输出
        System.out.println("人id："+person.getId()+",名字:"+person.getName()+",年龄："+person.getAge());
        return "SUCCESS";
    }
}
